package models

import (
	"driver_srv/basic/config"
	"time"
)

type Ar struct {
	ID        int32     `gorm:"column:id;type:int;comment:主键ID;primaryKey;" json:"id"`
	Name      string    `gorm:"column:name;type:varchar(255);comment:名称;" json:"name"`
	Age       int32     `gorm:"column:age;type:int;comment:年龄;" json:"age"`
	Address   string    `gorm:"column:address;type:varchar(255);comment:地址;" json:"address"`
	CreatedAt time.Time `gorm:"column:created_at;type:datetime;comment:创建时间;default:CURRENT_TIMESTAMP;" json:"created_at"`
	UpdatedAt time.Time `gorm:"column:updated_at;type:datetime;comment:更新时间;default:CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP;" json:"updated_at"`
	DeletedAt time.Time `gorm:"column:deleted_at;type:datetime;comment:删除时间;default:NULL;" json:"deleted_at"`
}

func (a *Ar) TableName() string {
	return "a"
}
func (a *Ar) Create() error {
	return config.DB.Create(a).Error
}
